﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="IWebApp2.WebForm4" %>
<b><%@ Implements Interface="System.Web.UI.ICallbackEventHandler" %></b>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <script runat="server">
        
        protected String aStringValue ="Anna";

        protected void Page_Load(object sender, EventArgs e)
        {

            ClientScriptManager cm = Page.ClientScript;
            String cbReference = cm.GetCallbackEventReference(this, "arg",
                "ReceiveServerData", "");
            String callbackScript = "function CallServer(arg, context) {" +
                cbReference + "; }";
            cm.RegisterClientScriptBlock(this.GetType(),
                "CallServer", callbackScript, true);

        }

        public void RaiseCallbackEvent(String eventArgument)
        {


        }

        public string GetCallbackResult()
        {
            return aStringValue;
        }

        
    </script>
    
    
    
    
    
    
    <script type="text/javascript">
function ReceiveServerData(arg, context)
{
    Message.innerText = 'Processed callback.';
}
</script>
    
</head>
<body>
    <form id="form1" runat="server">
    <input type="button" value="Callback" 
    onclick="CallServer(1, alert('Callback'))"/>
<br />
<span id="Message"></span>

    </form>
</body>
</html>
